import React, { Component } from 'react';

import { HashRouter as Router, Route, Switch, Redirect } from "react-router-dom";

import Tabbar from './components/tabbar/Tabbar';
import Home from './components/home/Home';
import Catgory from './components/catgory/Catgory';
import Cart from './components/cart/Cart';
import My from './components/my/My';
import SearchCenter from './components/searchCenter/SearchCenter';
import GoodsDetails from './components/goodsDetails/GoodsDetails';
import ProductList from './components/productList/ProductList';


class App extends Component {

  render() {
    return (
      <div>

        <Router>
          <Switch>
            <Route path="/home" render={(props) => <Tabbar {...props}><Home {...props}></Home></Tabbar>}></Route>
            <Route path="/catgory" render={(props) => <Tabbar {...props}><Catgory></Catgory></Tabbar>}></Route>
            <Route path="/cart" render={(props) => <Tabbar {...props}><Cart></Cart></Tabbar>}></Route>
            <Route path="/my" render={(props) => <Tabbar {...props}><My></My></Tabbar>}></Route>
            <Route path="/searchCenter" render={(props) => <SearchCenter {...props}></SearchCenter>}></Route>
            <Route path="/goodsDetails:id" render={(props) => <GoodsDetails {...props}></GoodsDetails>}></Route>
            <Route path="/productList" render={(props) => <ProductList {...props}></ProductList>}></Route>
            <Redirect to="home"></Redirect>
          </Switch>
        </Router>

      </div >
    );
  }
}

export default App;